# Maintainer: Frederic Wang <fred.wang@free.fr>

_realname=imagesize
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=1.2.0
pkgrel=1
pkgdesc="Getting image size from png/jpeg/jpeg2000/gif file (mingw-w64)"
url='https://github.com/shibukawa/imagesize_py'
license=('MIT')
arch=('any')
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("https://files.pythonhosted.org/packages/source/i/imagesize/${_realname}-${pkgver}.tar.gz")
sha256sums=('b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1')

prepare() {
  cd ${srcdir}
  cp -r ${_realname}-${pkgver} build-python-${CARCH}
}

build() {
  cd ${srcdir}/build-python-${CARCH}
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd ${srcdir}/build-python-${CARCH}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --skip-build
}
